/**
 * 收到请求时把网页响应回来
 */
const https = require("https");
const path = require("path");
const fs = require("fs");

var reqUrl = "https://maoyan.com/films";
var filePath = path.join(__dirname, "/movie.html");

https.get(reqUrl, (res) => {
    var str = "";
    res.on("data", (chunk) => {
        str += chunk;
    });
    res.on("end", () => {
        console.log(str);
        var w = fs.createWriteStream(filePath);
        w.write(str);
        w.end();
    });
});
